package createThread.cn.tedu.threaddemo.test9;

class DBUtils{
    private static final Object lock = new Object();
    private static volatile DBUtils instance = null;
    private DBUtils() {
    }
    public static DBUtils getInstance() {
       if(instance == null){
           synchronized (lock){
               if(instance == null){
                   instance = new DBUtils();

               }
           }
       }
        return instance;
    }
}

public class Demo3 {
    public static void main(String[] args) {

    }
}
